﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace YArchitech.Revit
{
	public class SprinklerFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is FamilyInstance)
			{
				FamilyInstance familyInstance = elem as FamilyInstance;
				BuiltInCategory integerValue = elem.Category.Id.IntegerValue;
				if (integerValue == -2008099)
				{
					return true;
				}
				if (integerValue == -2008085)
				{
					return true;
				}
				if (integerValue == -2001140 && (familyInstance.Symbol.Family.Name.Contains("消火栓") || familyInstance.Symbol.Family.Name.Contains("消防")))
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			return false;
		}
	}
}
